a54f5ed058d9c413aed5970127f541ecf4087af0,runtime/src/main/java/com/flipkart/phantom/runtime/impl/server/netty/TCPNettyServer.java,TCPNettyServer,afterPropertiesSet,#,62

Before Change


		}
		if (this.getWorkerExecutors() == null) {  // no executors have been set for workers
			if (this.getWorkerPoolSize() != TCPNettyServer.INVALID_POOL_SIZE) { // thread pool size has been set. create and use a fixed thread pool
				this.setWorkerExecutors(Executors.newFixedThreadPool(this.getWorkerPoolSize(), new NamedThreadFactory("TCPServer-Worker")));
			}else { // default behavior of creating and using a cached thread pool
				this.setWorkerExecutors(Executors.newCachedThreadPool(new NamedThreadFactory("TCPServer-Worker")));
			}

After Change


            if (this.getWorkerPoolSize() == TCPNettyServer.INVALID_POOL_SIZE) { // thread pool size has been set. create and use a fixed thread pool
                this.setWorkerPoolSize(Runtime.getRuntime().availableProcessors());
            }
            this.setWorkerExecutors(new ThreadPoolExecutor(this.getWorkerPoolSize(),
                    this.getWorkerPoolSize() * 4,
                    30,
                    TimeUnit.SECONDS,
                    new LinkedBlockingQueue<Runnable>(this.getWorkerPoolSize() * 12),
                    new NamedThreadFactory("TCPServer-Worker"),
                    new ThreadPoolExecutor.CallerRunsPolicy()));
        }